package com.ny.zmb.openapi.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

@Data
@AllArgsConstructor
@TableName("pm_api_log")
public class PmApiLog implements Serializable {

    private static final long serialVersionUID = 1L;
    @TableField("id")
    @TableId(type = IdType.AUTO)
    private Long id;
    private String url;
    private String body;
    private String returnObj;
    private Long userId;
    private Date createDate;
    private Date updateDate;


    public void setBody(String body) {
        this.createDate = new Date();
        this.body = body;
    }

    public void setReturnObj(String returnObj) {
        this.updateDate = new Date();
        this.returnObj = returnObj;
    }

    public PmApiLog() {
        this.createDate = new Date();
    }

    public PmApiLog(String url, String body) {
        this.url = url;
        this.createDate = new Date();
        this.body = body;
    }

    public PmApiLog setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
        return this;
    }

    @Override
    public String toString() {
        return "PmApiLog{" +
                "id=" + id +
                ", url='" + url + '\'' +
                ", body='" + body + '\'' +
                ", returnObj='" + returnObj + '\'' +
                ", userId=" + userId +
                ", createDate=" + createDate +
                ", updateDate=" + updateDate +
                '}';
    }
}
